/* 
 * File:   WatingRoom.h
 * Author: agu
 *
 * Created on 16 de junio de 2014, 20:18
 */

#ifndef WATINGROOM_H
#define	WATINGROOM_H
#include <gtkmm-3.0/gtkmm.h>
#include <string>
#include "client_socket.h"

using std::string;

class WatingRoom : public Gtk::Window {
public:
    WatingRoom();
    void run();
    void setWindowsBack(Gtk::Window *windowBack);
    void setSocket(Client_socket s);
    void setGameName(const string gameName);
    void setTotalPlayers(int totalPlayers);
    void setImagePath(const string imagePath);
    void setPlayerCode(const string codePlayer);
    string getPlayerCode();
    void userCreatorActive();
    ~WatingRoom();
private:
    void loadWidgets();
    void connectWidgets();
    void close();
    void cancel();
    void connect();
    void refresh();
    bool onTimeout();
    void send(const string msj);
    string recv();
    void loadGameInfo();
    void loadPlayersGameInfo();
    void refreshBar();
    Glib::RefPtr<Gtk::Builder> builder;
    Gtk::Window* window, *windowsBack;
    Gtk::Button *buttonConnect, *buttonCancel, *buttonRefresh;
    Gtk::Image *image;
    Gtk::Label *labelCampaign, *labelPlayJoined, *labelStatus;
    Gtk::ProgressBar *progressBar;
    int connectionIdTimeOut;
    Client_socket socket;
    string gameName;
    string imagePath;
    string playerCode;
    int totalPlayers;
    bool userCreator, canStart;
    bool gameFinish;
    
    //EndGame fin;
};

#endif	/* WATINGROOM_H */

